package cn.gok.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shikundai
 * @date 2021/3/24
 * @time 14:37
 * @description: 首页相关控制器
 */
@RestController
public class IndexController {
    @PostMapping("/login")
    public String login(@RequestParam("name")String name,@RequestParam("psw")String password){
        UsernamePasswordToken token=new UsernamePasswordToken(name, password);
        SecurityUtils.getSubject().login(token);
        //返回数据视情况而定可以使页面或者json数据
        return "OK";
    }
}
